From: Carlos Garnacho Date: Fri, 26 Sep 2025 03:25:15 +0000 (+0200) Subject: panelMenu: Port to using ClickGesture X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~126 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=80bc9d773cc550e9ca448741ac174b54c61073b6;p=gnome-shell.git panelMenu: Port to using ClickGesture Only enable this gesture if a menu is set, so there's no overlap with other gestures in buttons without a menu (e.g. the ActivitiesButton). Part-of: --- diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index a46a78b2b..b2ec479e5 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -102,6 +102,14 @@ export const Button = GObject.registerClass({ accessible_role: Atk.Role.MENU, }); + this._clickGesture = new Clutter.ClickGesture(); + this._clickGesture.set_recognize_on_press(true); + this._clickGesture.connect('recognize', () => { + this.menu?.toggle(); + }); + this._clickGesture.set_enabled(!dontCreateMenu); + this.add_action(this._clickGesture); + if (dontCreateMenu) this.menu = new PopupMenu.PopupDummyMenu(this); else @@ -130,18 +138,10 @@ export const Button = GObject.registerClass({ Main.uiGroup.add_child(this.menu.actor); this.menu.actor.hide(); } + this._clickGesture.set_enabled(this.menu !== null); this.emit('menu-set'); } - vfunc_event(event) { - if (this.menu && - (event.type() === Clutter.EventType.TOUCH_BEGIN || - event.type() === Clutter.EventType.BUTTON_PRESS)) - this.menu.toggle(); - - return Clutter.EVENT_PROPAGATE; - } - vfunc_hide() { super.vfunc_hide();